package com.controller.ht;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.common.ajax.AjaxRes;
import com.controller.base.BaseController;
import com.entity.testUser;
import com.service.UserIndustryService;
import com.service.testUserService;

@Controller
public class InsexpageController extends BaseController<Object>{
	
//	@Autowired
//	private GoodpriceService goodService;
	@Autowired
	private testUserService userService;
	@Autowired
	private UserIndustryService uiservice;
	
	
	//跳转主页
	@RequestMapping("/indexpage")
	public ModelAndView index()throws Exception{
//		Goodprice o=new Goodprice(); 
//		List<Goodprice> list=goodService.find(o);
//		System.out.println(list.size()+"*************");
		ModelAndView mv =  new ModelAndView();
		mv.setViewName("pulicpage/index");
		return mv;
	}

	@RequestMapping("/testcontent")
	public ModelAndView testcontent(){
		ModelAndView mv =  new ModelAndView();
		mv.setViewName("pages/content");
		return mv;
	}
	@RequestMapping("/formElements")
	public ModelAndView formElements(){
		ModelAndView mv =  new ModelAndView();
		mv.setViewName("pages/form-elements");
		return mv;
	}
	@RequestMapping("/IndustryContent")
	public ModelAndView IndustryContent(Model model){
		ModelAndView mv =  new ModelAndView();
		mv.setViewName("pages/IndustryContent");
		return mv;
	}
	@RequestMapping("/UserContent")
	public ModelAndView UserContent(Model model){
		ModelAndView mv =  new ModelAndView();
		mv.setViewName("pages/UserContent");
		return mv;
	}
	@RequestMapping("/UploaderContent")
	public ModelAndView UploaderContent(Model model){
		ModelAndView mv =  new ModelAndView();
		mv.setViewName("pages/uploaderContent");
		return mv;
	}
	@RequestMapping("/informationContent")
	public ModelAndView informationContent(Model model){
		ModelAndView mv =  new ModelAndView();
		mv.setViewName("pages/informationContent");
		return mv;
	}
	@RequestMapping("/newsColumnContent")
	public ModelAndView newsColumnContent(Model model){
		ModelAndView mv =  new ModelAndView();
		mv.setViewName("pages/newsColumnContent");
		return mv;
	}
	@RequestMapping("/loginContent")
	public ModelAndView loginContent(Model model){
		ModelAndView mv =  new ModelAndView();
		mv.setViewName("pages/login");
		return mv;
	}
	@RequestMapping("/loginInfo")
	public ModelAndView loginInfo(Model model){
		ModelAndView mv =  new ModelAndView();
		mv.setViewName("pages/LoginInfo");
		return mv;
	}
	@RequestMapping("/productContent")
	public ModelAndView productContent(Model model){
		ModelAndView mv =  new ModelAndView();
		mv.setViewName("pages/ProductContent");
		return mv;
	}
	@RequestMapping("/substu")
	@ResponseBody
	public AjaxRes substu(testUser user){
//		ModelAndView mv =  new ModelAndView();]
		AjaxRes res = new AjaxRes();
		System.out.println(user.getUser_name()+"  "+user.getUser_tel()+"  "+user.getUser_id());
		testUser u = new testUser();
		u.setUser_id("00000");
		u.setUser_name(user.getUser_name());
		u.setUser_tel(user.getUser_tel());
		//添加USER
		int a = userService.insert(u);
		if(a==0){
			res.setResMsg("添加失败");
		}else{
			res.setResMsg("添加成功");
			
		}
		return res;
	}
}
